<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-row>
      <el-col :span='22' :xs='24'>
        <el-form ref="form" :model="s_access" :rules="rules" label-width="100px" id="mvcfm">
          <el-button @click="gotoPage('/oa/humanresources/StaffRegisterInfoUp?'+vueparams+'')" type='success' size="mini"><i class='fa fa-edit'></i>修改账户密码</el-button>
          <div class="form-unit">
            <span class="mvc-title-left"> 登陆信息 </span>
          </div>
          <div>
            <el-row>
              <el-col :span="24">
                <el-form-item label="登陆账号" prop="">
                  {{s_access.username}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="账号邮箱" prop="">
                  {{s_access.email}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="上次登录" prop="">
                  {{getDateTimeString(s_access,'last_login')}}
                </el-form-item>
              </el-col>
            </el-row>
          </div>
          <el-button @click="popStaffRegisterEmailPassUp('')" type='success' size="mini"><i class='fa fa-edit'></i>修改个人邮箱</el-button>
          <div class="form-unit">
            <span class="mvc-title-left"> 个人邮箱 </span>
          </div>
          <div>
            <el-row>
              <el-col :span="24">
                <el-form-item label="邮箱" prop="">
                  {{s_relation.relation_email}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="授权码" prop="">
                  {{s_relation.email_password}}
                </el-form-item>
              </el-col>
            </el-row>
          </div>
        </el-form>
      </el-col>
      <el-col :span='2' :xs='24'>
        <el-menu default-active='active' class='menu-unit'>
          <el-menu-item v-for='item in Container'>
            <el-link @click="gotoMenu(item.url)" :type="'账户信息'===item.name?'primary':'default'">{{item.page_desc||item.name}}</el-link>
          </el-menu-item>
        </el-menu>
      </el-col>
    </el-row>
    <el-dialog :visible.sync="StaffRegisterEmailPassUpVisible" append-to-body>
      <StaffRegisterEmailPassUp v-if="StaffRegisterEmailPassUpVisible" ref="StaffRegisterEmailPassUp" :popparams="popparams"> </StaffRegisterEmailPassUp>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import StaffRegisterEmailPassUp from "@/views/oa/humanresources/StaffRegisterEmailPassUp";
  export default {
    name: 'StaffRegister',
    components: {
      StaffRegisterEmailPassUp,
    },
    props: ['popparams'],
    data() {
      return {
        StaffRegisterEmailPassUpVisible: false,
        StaffRegisterEmailPassUpValue: null,
        StaffRegisterEmailPassUpDesc: null,
        vueparams: this.getVUEParams(""),
        s_access: {
          username: null,
          email: null,
          last_login: null,
        },
        s_relation: {
          relation_email: null,
          email_password: null,
        },
        loading: false,
        Container: null,
        rules: {}
      }
    },
    created() {
      this.getData();
      this.loadContainerMenu({
        pid: "507F29B70D824801B06B178B061EF810",
        name: "员工管理右菜单",
        selected: "账户信息"
      }, 'Container', this.vueparams);
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/oa/humanresources/EmployeeAction/staffRegister?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      popStaffRegisterEmailPassUp(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.StaffRegisterEmailPassUpVisible = !this.StaffRegisterEmailPassUpVisible;
      },
    },
  }
</script>
